package algorithm.tree.binarySortTree_BST;

public class BTS {
    //根节点
    Node root;

    //添加
    public void add(Node n){
        if (root == null){
            root = n;
        }else{
            root.add(n);
        }
    }
    //给外部中序遍历的接口
    public void show(){
        midOrder(root);
    }
    //中序遍历
    private void midOrder(Node n){
        //左边
        if (n == null)
            return;
        if (n.left != null){
            midOrder(n.left);
        }
        //打印
        System.out.println(n);
        //右边
        if (n.right != null){
            midOrder(n.right);
        }
    }

}
